package cn.itcast.bindservice;

import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity implements View.OnClickListener
{
    private MyService.MyBinder myBinder;
    private MyConn myconn;
    private Button btn_bind, btn_call, btn_unbind;
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        init();
    }
    private void init() {
        btn_bind = findViewById(R.id.btn_bind);
        btn_call = findViewById(R.id.btn_call);
        btn_unbind = findViewById(R.id.btn_unbind);
        //设置3个按钮的点击监听事件
        btn_bind.setOnClickListener(this);
        btn_call.setOnClickListener(this);
        btn_unbind.setOnClickListener(this);
    }
    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_bind:
                //TODO “绑定服务”按钮点击事件

                break;
            case R.id.btn_call:
                //TODO "调用服务中的方法”按钮点击事件

                break;
            case R.id.btn_unbind:
                //TODO “解绑服务”按钮点击事件

                break;
        }
    }
    /**
     * TODO 创建MyConn类,用于实现连接服务
     */
    private class MyConn  {

    }
}

